package com.wanmei.controller.product;

import com.github.pagehelper.PageInfo;
import com.wanmei.pojo.Category;
import com.wanmei.service.Impl.ProductServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping("product")
public class CategoryListController {
    @Autowired
    private ProductServiceImpl productService;
    /**
     * 分类列表视图
     * @return
     */
    @RequestMapping("/listCategory")
    public ModelAndView listCategery(@RequestParam(value = "pageNum",defaultValue = "1") int pageNum,
                                     @RequestParam(value = "pageSize",defaultValue = "10") int pageSize){

        ModelAndView mv=new ModelAndView();
        PageInfo<Category> pageInfo=productService.showProductCategory(pageNum,pageSize);
        System.out.println("类别信息"+pageInfo);
        mv.addObject("pageInfo",pageInfo);
        mv.setViewName("/product/categoryList");
        return mv;
    }
}
